package RMISnake;

import java.rmi.*;
import java.rmi.server.*;
import java.util.Hashtable;

public class CallBackImp extends UnicastRemoteObject implements CallBack {
	private SnakeClient thisClient;

	public CallBackImp(Object client) throws RemoteException {
		thisClient = (SnakeClient) client;
	}

	public void addMessage(String from, String message) throws RemoteException {
		thisClient.getMessageBox().append("<" + from + ">" + message + "\n");
	}

	public void quitMessage(String from) throws RemoteException {
		thisClient.getMessageBox().append(from + " has left.\n");
	}

	public void joinedMessage(String from) throws RemoteException {
		thisClient.getMessageBox().append(from + " has joined.\n");
	}

	@Override
	public void repaint(Hashtable snakes) throws RemoteException {
		// TODO Auto-generated method stub
		thisClient.repaint(snakes);
	}
}
